Skip to main content

text

Type

property

Summary

Specifies the text contained by a button or field or the binary data in an image.

Syntax

set the text of {<button> | <field> | <image>} to <string>

Description

Use the text property to work with the contents of a field, button, or image.

Fields The text of a field is simply the contents of the field. You can also use the target keyword to obtain the contents of a field :

    the text of the target is target
-- evaluates to true if target is a field

The text of a field is always returned in the native encoding.

Buttons

The text of a button is used as the button's menu contents. (A menu whose contents is the text of a button is called a button menu. ) If the button's style is not set to "menu", the setting of its text property has no effect. However, the text property can be used to store data in a button, regardless of the button's style; the text is not visible to the user unless the button is a button menu.

See the menu entry for more information about the format of menu item entries in the menu button text.

The text of a button is always returned in the native encoding.

Images

The text of an image is the binary data that makes up the image. The following formats are supported:

####Fully Supported Formats

Setting the text to one of these formats displays the image as expected and sets the paintCompression to the correct type automatically. The data is also preserved meaning that getting the text returns the original data unchanged.

  • GIF (All platforms)
  • JPEG (All platforms)
  • PNG (All platforms)
  • WMF (Windows only - Windows Metafile)
  • EMF (Windows only - Windows Enhanced Metafile)

Import Only Formats

There are also some formats that are not fully supported but can be imported. The image is converted to one of the supported formats, depending on the global paintCompression property.

  • BMP (Windows bitmap)
  • XWD (X Windows Dump format)
  • XBM (X Windows Bitmap)
  • XPM (X Windows Pixmap)
  • PBM (NetPBM Portable Bitmap)
  • PGM (NetPBM Portable Greyscale Map)
  • PPM (NetPBM Portable Pixmap)
note

Indeed, it is odd to be calling binary data the "text" property. The usage came about for historical reasons.

These two statements are equivalent:

    set the text of object tObjectId to tString
put tString into object tObjectId
tip

Instead of displaying a button's text when using the button as a menu, you can designate a stack to be displayed as the menu contents. This type of menu is called a stack menu. If the button's menuName property is not empty, the stack specified by the menuName is used as the menu contents, instead of the button'stext property.

Examples

put the text of button "Popup" into menuContents
set the text of field "Display Script" to the script of the target

property: menuName, style, unicodeText, paintCompression

function: target

glossary: property, keyword, binary file, stack menu, button menu

keyword: button, image, field, string, menu

object: stack, button

Compatibility and Support

Introduced

LiveCode 1.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?